package kr.phistory.validator;

import kr.phistory.domain.PHistoryCommand;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;


public class PHistoryValidator implements Validator{
	
	@Override
	public boolean supports(Class<?> clazz) {
		return PHistoryCommand.class.isAssignableFrom(clazz);
	}
	
	@Override
	public void validate(Object target, Errors errors) {
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "ph_model", "required");		
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "ph_name", "required");		
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "ph_phone", "required");		
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "ph_plate", "required");
		
	}
}
